<html xmlns:concordion="http://www.concordion.org/2007/concordion">
    <head>
        <link href="../../../concordion.css" rel="stylesheet" type="text/css" />
    </head>
    <body>

        <h1>Deadlock Prevention</h1>
    
        <p>
            If an application has two pools that are both full, it should not 
            be possible to deadlock the system if threads need access to both
            pools.
        </p>
        
        <div class="example">
        
            <ul>
                <li>Two pools are created each with a maximum size of <span concordion:set="#poolSize">1</span> and a max
                    blocking time of <span concordion:set="#blockingTime">2</span> seconds</li>
                <li>Thread A checks out a connection from the first pool</li>
                <li>Thread B checks out a connection from the second pool</li>
                <li>Thread A tries to check out a connection from the second pool, but none are available</li>
                <li>Thread B tries to check out a connection from the first pool, but none are available</li>
                <li>Thread A and B both timeout within 
                <span concordion:assertEquals="checkoutFromPoolsAndReturnTimeout(#poolSize, #blockingTime)">3</span> seconds with an exception
                and both pools have an active count of <span concordion:assertEquals="getActiveCount()">0</span></li>
            </ul>
            
        </div>

    </body>
</html>